package org.westos.demo;

import java.util.Scanner;

public class lianxi2 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入x的系数");
        double k = sc.nextDouble();
        Scanner sc1 = new Scanner(System.in);
        System.out.println("请输入-b的值");
        double b = sc1.nextDouble();
        int x= (int) ((-b)/k);
        if (k==0&&b==0){
            System.out.println("有无数个解");
        }else if (k==0&&b!=0){
            System.out.println("方程无解");
        }else if (k!=0&&b==0){
            x=0;
            System.out.println(x);
        }else if (k!=0&&b!=0){
            if (x>0){
                System.out.println(x);
            }else {
                System.out.println(-1);
            }
        }
    }
}
